package com.paotui.controller;

import cn.hutool.json.JSONUtil;
import com.paotui.common.R;
import com.paotui.service.impl.UsersAddressServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/users/address/remove")
public class UsersAddressRemoveController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int addressID = Integer.parseInt(request.getParameter("AddressID"));
        UsersAddressServiceImpl impl = new UsersAddressServiceImpl();
        impl.removeById(addressID);
        R r = R.success("删除成功");
        response.getWriter().write(JSONUtil.toJsonStr(r));
    }
}
